package com.ruibang.glass.produce.controller.yl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruibang.glass.frequencycontrol.annotation.FrequencyControl;
import com.ruibang.glass.produce.domain.req.DcsRealTimeDataReq;
import com.ruibang.glass.produce.domain.req.ElectricSysTrendChartReq;
import com.ruibang.glass.produce.domain.resp.dcs.yl.*;
import com.ruibang.glass.produce.service.DcsYlRealTimeDataService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;


/**
 * @Author: songJinKang
 * @CreateTime: 2024-04-23  14:53
 * @Description: TODO:DCS-窑炉实时数据控制器
 * @Version: 1.0
 */

@Api(tags = "DCS-窑炉实时数据控制器")
@RestController
@RequestMapping("/api/glass/produce/dcs/yl")
public class DcsYlRealTimeDataController {

    @Autowired
    private DcsYlRealTimeDataService dcsYlRealTimeDataService;

    /**
     * 查询
     */
    @PostMapping("/queryTankFurnaceTemp")
    @ApiOperation(value = "池炉温度数据", response = ResultBody.class)
    public ResultBody<IPage<TankFurnaceTemp>> queryTankFurnaceTemp(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.queryTankFurnaceTemp(dcsRealTimeDataReq));
    }

    @PostMapping("/queryCombustionSystem")
    @ApiOperation(value = "燃烧系统数据", response = ResultBody.class)
    public ResultBody<IPage<CombustionSystem>> queryCombustionSystem(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.queryCombustionSystem(dcsRealTimeDataReq));
    }

    @PostMapping("/queryCoolingWaterSystem")
    @ApiOperation(value = "冷却水系统数据", response = ResultBody.class)
    public ResultBody<IPage<CoolingWaterSystem>> queryCoolingWaterSystem(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.queryCoolingWaterSystem(dcsRealTimeDataReq));
    }

    @PostMapping("/queryElectricAssistedMeltingSys")
    @ApiOperation(value = "电助熔系统", response = ResultBody.class)
    public ResultBody<IPage<ElectricAssistedMeltingSys>> queryElectricAssistedMeltingSys(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.queryElectricAssistedMeltingSys(dcsRealTimeDataReq));
    }

    @PostMapping("/queryFeedingSystem")
    @ApiOperation(value = "投料系统数据", response = ResultBody.class)
    public ResultBody<IPage<FeedingSystem>> queryFeedingSystem(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.queryFeedingSystem(dcsRealTimeDataReq));
    }

    @PostMapping("/queryPoolWallFan")
    @ApiOperation(value = "池壁风机数据", response = ResultBody.class)
    public ResultBody<IPage<PoolWallFan>> queryPoolWallFan(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.queryPoolWallFan(dcsRealTimeDataReq));
    }

    @PostMapping("/querySmokeSystem")
    @ApiOperation(value = "烟气系统数据", response = ResultBody.class)
    public ResultBody<IPage<SmokeSystem>> querySmokeSystem(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.querySmokeSystem(dcsRealTimeDataReq));
    }

    /**
     * 趋势图
     */
    @PostMapping("/tankFurnaceTempTrendChart")
    @ApiOperation(value = "池炉温度趋势图", response = ResultBody.class)
    public ResultBody<TankFurnaceTempTrendChart> tankFurnaceTempTrendChart(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.tankFurnaceTempTrendChart(dcsRealTimeDataReq));
    }

    @PostMapping("/feedingSystemTrendChart")
    @ApiOperation(value = "投料系统趋势图", response = ResultBody.class)
    public ResultBody<FeedingSystemTrendChart> feedingSystemTrendChart(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsYlRealTimeDataService.feedingSystemTrendChart(dcsRealTimeDataReq));
    }

    @PostMapping("/electricAssistedMeltingSysTrendChart")
    @ApiOperation(value = "电助熔系统趋势图", response = ResultBody.class)
    public ResultBody<ElectricSysTrendChart> electricAssistedMeltingSysTrendChart(@RequestBody @Valid ElectricSysTrendChartReq electricSysTrendChartReq) {
        return ResultBody.success(dcsYlRealTimeDataService.electricAssistedMeltingSysTrendChart(electricSysTrendChartReq));
    }


    /**
     * 导出
     */
    @PostMapping("/exportTankFurnaceTemp")
    @ApiOperation(value = "导出池炉温度数据", response = ResultBody.class)
    @FrequencyControl(time = 15, count = 2, target = FrequencyControl.Target.IP)
    @FrequencyControl(time = 30, count = 5, target = FrequencyControl.Target.IP)
    public void exportTankFurnaceTemp(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsYlRealTimeDataService.exportTankFurnaceTemp(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportCombustionSystem")
    @ApiOperation(value = "导出燃烧系统数据", response = ResultBody.class)
    @FrequencyControl(time = 15, count = 2, target = FrequencyControl.Target.IP)
    @FrequencyControl(time = 30, count = 5, target = FrequencyControl.Target.IP)
    public void exportCombustionSystem(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsYlRealTimeDataService.exportCombustionSystem(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportCoolingWaterSystem")
    @ApiOperation(value = "导出冷却水系统数据", response = ResultBody.class)
    @FrequencyControl(time = 15, count = 2, target = FrequencyControl.Target.IP)
    @FrequencyControl(time = 30, count = 5, target = FrequencyControl.Target.IP)
    public void exportCoolingWaterSystem(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsYlRealTimeDataService.exportCoolingWaterSystem(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportElectricAssistedMeltingSys")
    @ApiOperation(value = "导出电助熔系统", response = ResultBody.class)
    @FrequencyControl(time = 15, count = 2, target = FrequencyControl.Target.IP)
    @FrequencyControl(time = 30, count = 5, target = FrequencyControl.Target.IP)
    public void exportElectricAssistedMeltingSys(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsYlRealTimeDataService.exportElectricAssistedMeltingSys(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportFeedingSystem")
    @ApiOperation(value = "导出投料系统数据", response = ResultBody.class)
    @FrequencyControl(time = 15, count = 2, target = FrequencyControl.Target.IP)
    @FrequencyControl(time = 30, count = 5, target = FrequencyControl.Target.IP)
    public void exportFeedingSystem(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsYlRealTimeDataService.exportFeedingSystem(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportPoolWallFan")
    @ApiOperation(value = "导出池壁风机数据", response = ResultBody.class)
    @FrequencyControl(time = 15, count = 2, target = FrequencyControl.Target.IP)
    @FrequencyControl(time = 30, count = 5, target = FrequencyControl.Target.IP)
    public void exportPoolWallFan(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsYlRealTimeDataService.exportPoolWallFan(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportSmokeSystem")
    @ApiOperation(value = "导出烟气系统数据", response = ResultBody.class)
    @FrequencyControl(time = 15, count = 2, target = FrequencyControl.Target.IP)
    @FrequencyControl(time = 30, count = 5, target = FrequencyControl.Target.IP)
    public void exportSmokeSystem(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsYlRealTimeDataService.exportSmokeSystem(dcsRealTimeDataReq, response);
    }
}
